<script setup>
import { onMounted, ref } from 'vue'
import {
  NLayout,
  NTooltip,
  NFloatButton,
  NIcon,
  NFlex,
  NButton,
  NLayoutSider,
  NMessageProvider,
  NModalProvider,
  NDialogProvider
} from 'naive-ui'
import useGlobalStore from './store/GlobalInfo.js'
import Sider from './views/sider.vue'
import Main from './views/main.vue'
import Control from './components/store/control.vue'
const store = useGlobalStore()
const isInitialized = ref(false)
onMounted(async () => {
  const preset = await window.store.get('preset')
  const components = await window.store.get('components')
  store.config.preset = preset
  store.config.components = components
  console.log("组件",store.config.components);
  
  isInitialized.value = true
})
</script>

<template>
  <n-dialog-provider>
    <n-modal-provider>
      <n-message-provider>
        <n-layout v-if="isInitialized" has-sider style="height: 100%">
          <n-layout-sider bordered content-style="padding: 24px;" :native-scrollbar="false">
            <Sider />
          </n-layout-sider>
          <n-layout :native-scrollbar="false">
            <!-- 管理组件 -->
            <Control />
            <Main />
          </n-layout>
        </n-layout>
      </n-message-provider>
    </n-modal-provider>
  </n-dialog-provider>
</template>
